<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h1>{{msg}}</h1>
      <com1></com1>

      <com1>
          <div>{{Toast()}}</div>
      </com1>
      
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>

        var com1={
            data() {
                return {
                    msg:'com1'
                }
            },
            template:`
            <div>
            <h2>{{msg}}</h2>

            <slot></slot>
            </div>
            `
        }

        var com2 ={

        }
      var vm = new Vue({
        el: "#app",
        data: {
          msg: "vue",
        },
        comments:{
            com1
        },
        methods: {
            Toast(){
                alert(1)
                return '牛逼'
            }
        },
      });
    </script>
  </body>
</html>
